Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
array-unique
Advanced tools
Package description
The array-unique npm package is a small utility that removes duplicate values from an array. It is useful when you need to ensure that an array contains only unique items without having to write custom deduplication logic.
Deduplicate an array
This feature allows you to remove duplicate values from an array, resulting in an array of only unique items. The `arrayUnique` function is used as a callback for the `filter` method.
[1, 2, 2, 3, 4, 4, 5, 5].filter(arrayUnique)
Lodash is a popular utility library that includes a `uniq` function. This function is similar to array-unique in that it removes duplicate values from an array. Lodash offers a wide range of additional utility functions, which makes it a more comprehensive solution than array-unique, but also larger in size.
Underscore.js is another utility library that provides a `uniq` function, similar to array-unique. It is comparable to Lodash in functionality and size, and it also offers a wide range of utility functions beyond array deduplication.
Ramda is a functional programming library that includes a `uniq` function. It is designed with a focus on functional programming patterns and immutability. Ramda's `uniq` function provides similar functionality to array-unique, but within the context of a larger functional programming toolkit.
Readme
Return an array free of duplicate values. Fastest ES5 implementation.
npm i array-unique --save
var unique = require('array-unique');
unique(['a', 'b', 'c', 'c']);
//=> ['a', 'b', 'c']
Install dev dependencies.
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 24, 2015.
FAQs
Remove duplicate values from an array. Fastest ES5 implementation.
We found that array-unique demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).